//---------------------------------------------------------------------------

#include <vcl.h>
#pragma hdrstop

#include "groupPrompt.h"
#include "about.h"
#include "datamodule.h"
#include "Group.h"
#include "letter.h"
#include "main.h"
#include "pay.h"
#include "Report.h"
#include "Search.h"
#include "spravka.h"
#include "StatForm.h"
#include "StudentList.h"
#include "StudentWorks.h"
#include "Teacher.h"
#include "TeacherList.h"
#include "Work.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TgroupPromptForm *groupPromptForm;

//---------------------------------------------------------------------------
__fastcall TgroupPromptForm::TgroupPromptForm(TComponent* Owner)
    : TForm(Owner)
{
}
//---------------------------------------------------------------------------


void __fastcall TgroupPromptForm::FormShow(TObject *Sender)
{
    int bm = dm->adGroups->RecNo;

    dm->adGroups->First();
    ComboBox1->Clear();

    while(!dm->adGroups->Eof)
    {
        ComboBox1->Items->Add(dm->adGroups->FieldByName("Group_Number")->AsString);
        ComboBox2->Items->Add(dm->adGroups->FieldByName("LKTeacherName")->AsString);
        dm->adGroups->Next();

    }
    dm->adGroups->RecNo = bm;

    ComboBox1->ItemIndex = 0;
    ComboBox2->ItemIndex = 0;
    ComboBox1->SetFocus();
}
//---------------------------------------------------------------------------


void __fastcall TgroupPromptForm::BitBtn1Click(TObject *Sender)
{
    dm->adGroups->First();

    while(!dm->adGroups->Eof)
    {
        if (dm->adGroups->FieldByName("Group_Number")->AsInteger == StrToInt(ComboBox1->Text))
        {
            Tag = dm->adGroups->FieldByName("GroupCode")->AsInteger;
            Close();

        }
        dm->adGroups->Next();
    }
}
//---------------------------------------------------------------------------


void __fastcall TgroupPromptForm::BitBtn2Click(TObject *Sender)
{
     Close();
}
//---------------------------------------------------------------------------



void __fastcall TgroupPromptForm::ComboBox1Change(TObject *Sender)
{
    ComboBox2->ItemIndex = ComboBox1->ItemIndex;    
}
//---------------------------------------------------------------------------


